<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/18 0018
 * Time: 上午 10:09
 */

namespace App\Http\Classes;


class AvatarUpload
{
    private $path = 'avatar';
    private $allowtype = ['jpg', 'png', 'gif'];
    private $israndname = true;
    private $FileUpload = null;
    private $field = '';

    public function __construct($field = '')
    {
        $this->field = $field;
        $this->FileUpload = new FileUpload();
        $this->FileUpload->set('allowtype', $this->allowtype)->set('israndname', $this->israndname)->set('path', $this->path);
    }

    public function upload()
    {
        return $this->FileUpload->upload($this->field);
    }

    public function getErrorMessage()
    {
        return $this->FileUpload->getErrorMessage();
    }

    public function getSavePaths()
    {
        return $this->FileUpload->getSavePaths();
    }
}